<?php
include("../admin/sesiune.php");
$username = $_SESSION["username"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Clothes</title>
</head>
<body>
<p align="right">
<?php 
if(isset($_SESSION["username"]))
	{
	echo "You are logged in as $username!";
	}
else
{
echo "You are not logged in!";
}
?>
</p>
<?php
$query ="SELECT numeProd, detalii, ID, pret, upload FROM produse WHERE cat_id = 3 ORDER BY id";
$showProd = mysql_query($query,getConnection()) or die (mysql_error());
$nr = mysql_num_rows($showProd);
if($nr>0)
{
	while ($displayProd= mysql_fetch_array($showProd)) 
	{	
		echo "<table><tr><td>Nume</td><td>$displayProd[numeProd]</td></tr><tr><td>Detalii</td><td>$displayProd[detalii]</td></tr><tr><td>Pret</td><td>$displayProd[pret]</td></tr></table>"."<br/>";
		
?>
		<img src="uploads/<?php echo $displayProd["upload"];?>">
		<form action="../cosQuery.php" method="post">
		<input type="hidden" name="ID" value="<?php echo $displayProd["ID"];?>" >
		<?php 
		if(isset($_SESSION["username"]))
		{
			echo "<input type='submit' value='Add me!'>";
		}
		else
		{
			echo "Log in to add in cart! (free sign up!!!)";
		}
		?>
		</form>
	
<?php 
	}
}
else
{
	echo "<div style='background:red;color:white;font-weight:bold;'>Nu exista produse</div>";
}
?>
</body>
</html>
